from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select
import time
testCase = "DBshop011"
firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
firefox.find_element_by_xpath('//p/a[6]').click()
firefox.find_element_by_partial_link_text('添加商品').click()
time.sleep(5)
firefox.find_element_by_id('goods_name').send_keys('苹果XR')
firefox.find_element_by_id('goods_shop_price').send_keys('7999')
s = Select(firefox.find_element_by_id('goods_type'))
s.select_by_visible_text('虚拟商品')
firefox.find_element_by_xpath('//button[contains(text(),"保存商品")]').click()

try:
    firefox.find_element_by_xpath('//td[contains(.,"苹果XR")]')
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)